<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link href="CSS/bootstrap.min.css" rel="stylesheet">
    <link rel="icon" href="img/icon.png">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="CSS/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="CSS/animate.css" rel="stylesheet">
    <link href="CSS/style.css" rel="stylesheet">
    <script src="JS/jquery-2.1.1.js"></script>
    <script src="JS/bootstrap.min.js"></script>
    <script src="JS/plugins/iCheck/icheck.min.js"></script>
    <script type="text/javascript">
        $(function(){
              //信息不全时登录不可点击
             $("input").on("input",function () {
                // var name=$("#name").val();
                // var password=$("#password").val();
                if($("#name").val()!=""&&$("#password").val()!=""){
                    $("#login").prop("disabled",false);
    
                }else{
                    $("#login").prop("disabled",true);
                }
            });
        });
        function loginin() {
            $.ajax({
                type: "POST",
                url: "http://localhost:8080/employee/login",
                data: $('#loginTo').serialize(),
                success: function(result) {
                    if(result=="成功"){
                        sessionStorage.setItem('Islogin',"1");
                        window.location.href='index.html';
                    }else{
                        alert("用户名或密码错误");
                    }
                },
                error:function (e) {
                    alert("请求失败"+e.toString())
                }
            });
        }
    </script>
</head>
<body class="gray-bg">
    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name">0.0</h1>
            </div>
            <form id="loginTo" class="m-t" role="form" action="login.html">
                <div class="form-group">
                    <input id="name" name="employee_id" type="text" class="form-control" placeholder="职工编号">
                </div>
                <div class="form-group">
                    <input id="password"  name="employee_pwd" type="password" class="form-control" placeholder="职工密码">
                </div>
                <input id="login" disabled="disabled" type="button" class="btn btn-primary block full-width m-b" value="登录" onclick="loginin()">
                <a href="#"><p class="text-muted text-center">忘记密码？</p></a>
            </form>
        </div>
    </div>
</body>
</html>
